<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tests', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->default('0')->comment('用户 ID');
            $table->unsignedInteger('unit_id')->default('0')->comment('单位 ID');
            $table->unsignedInteger('question_count')->default('0')->comment('题目数量');
            $table->unsignedInteger('pre_score')->default('0')->comment('每题分值');
            $table->unsignedInteger('test_score')->default('0')->comment('考试得分');
            $table->unsignedInteger('test_time')->default('0')->comment('考试时间（分钟）');
            $table->unsignedTinyInteger('is_all_right')->default('0')->comment('是否满分');
            $table->text('questions')->comment('题目');
            $table->timestamp('submit_at')->nullable()->comment('提交时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tests');
    }
}
